#pragma  once

template <class T> 
class CSingleton
{
public:
    static T* GetInstance()
    { 
        if ( NULL == m_instance )
        {
            m_instance = new T;
        }

        return m_instance;
    }

    static void ReleaseInstance()
    {
        if ( NULL != m_instance )
        {
            delete m_instance;
            m_instance = NULL;
        }
    }

protected:
    CSingleton() {}
    virtual ~CSingleton() {/*ReleaseInstance();*/}

private:
    CSingleton(const CSingleton&){};
//     Singleton& operator=(const Singleton&){};

private:
    static T* m_instance;
};

template <class T>
T* CSingleton<T>::m_instance = NULL;

